package ds.recursive;

public class Towers {

	public static void doTowers(int topN, char from, char inter, char to)
	{
		if(topN == 1) // when n=1, move directly
		{
			System.out.println("Disk 1 from " + from + " to " + to);
		}
		else
		{
			doTowers(topN-1,from,to,inter); // (n-1)from --> inter
			
			System.out.println("Disk " + topN + " from " + from + " to " + to);
			                                // move the 'n' to destination
			
			doTowers(topN-1,inter,from,to); // (n-1)inter --> to
		}
	}
	
	public static void doTowers(int n)
	{
		doTowers(n, 'a', 'b', 'c');
	}
}

class TowersApp {
	public static void main(String[] args){
		Towers.doTowers(2);
	}
}
